package demo;

public class Student {
    private String name;
    private int age;
    private String stuNum;

    public static String classroom = "C114";

    public Student(String name,int age,String stuNum){
        this.name =name;
        this.age =age;
        this.stuNum = stuNum;
        System.out.println("带有三个参数的代码块...");
    }
    public Student(){
        System.out.println("无参的代码块...");
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getStuNum() {
        return stuNum;
    }

    public void setStuNum(String stuNum) {
        this.stuNum = stuNum;
    }
    public void show(){
        System.out.println("姓名:"+this.name+"学号:"+stuNum+"年龄:"+age);
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", stuNum='" + stuNum + '\'' +
                '}';
    }
    {
        this.name = "王五";
        System.out.println("普通代码块执行...");
    }
    static {
        classroom = "Java";
        System.out.println("静态代码块执行....");
    }
}
